package handler;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpServerCodec;
import lombok.Data;

@Data
public class HttpServerInitializer extends ChannelInitializer<SocketChannel> {
    protected void initChannel(SocketChannel ch) throws Exception {
        ch.pipeline().addLast("codec",new HttpServerCodec());
        ch.pipeline().addLast("aggregator",new HttpObjectAggregator(1048576));
        ch.pipeline().addLast("handler",new HttpServerHandler());
    }
}
